import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '部门',
    align:"center",
    dataIndex: 'departName'
   },
   {
    title: '学期',
    align:"center",
    dataIndex: 'semesterName'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '学号',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '科目',
    align:"center",
    dataIndex: 'courseName'
   },
   {
    title: '上课日',
    align:"center",
    dataIndex: 'attendDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime',
    customRender:({text}) =>{
      return !text?"":text
    },
   }, 
   {
    title: '状态',
    align:"center",
    dataIndex: 'status',
    customRender:({text}) =>{
      return render.renderDict(text, 'subject_status');
    },
    
   },
   {
    title: '审批时间',
    align:"center",
    dataIndex: 'approvalsDate'
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '部门',
    field: 'departmentId',
    component: 'JSelectDept',
    componentProps:{
      // checkStrictly:true,
      field:'deptId',
      multiple:false,
      params:{
        businessCode:1002
      }
    }
  },
  {
    label: "学期",
    field: 'semesterId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
    },
    //colProps: {span: 6},
  },
  {
   label: '姓名',
   field: 'name',
   component: 'Input',
  },
  {
    label: '学号',
    field: 'code',
    component: 'Input',
   },
     {
      label: "上课日",
      field: "attendDate",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
      },
      //colProps: {span: 6},
	},
	{
      label: "状态",
      field: 'status',
      component: 'JDictSelectTag',
      componentProps:{
        dictCode:"subject_status"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '学期',
    field: 'semesterId',
    component: 'JDictSelectTag',
    required:true,
    componentProps:{
      dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
    }
  },
  {
    label: '科目',
    field: 'courseIds',
    component: 'JSelectMultiple',
    required:true,
    componentProps:{
      dictCode:"cs_courses where del_flag=0,name,id"
    }
  },
  {
    label: '时间段',
    field: 'dateRange',
    component: 'RangeDate',
    componentProps: {
      //日期格式化
      format:'YYYY-MM-DD',
      //范围文本描述用集合
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入有效开始时间!'},
          ];
     },
  }
];

export const searchApprovalsFormSchema: FormSchema[] = [
 {
  label: "学期",
  field: 'semesterId',
  component: 'JDictSelectTag',
  componentProps:{
    dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
  },
  //colProps: {span: 6},
},
  {
    label: '学号',
    field: 'code',
    component: 'Input',
   },
   {
    label: '姓名',
    field: 'name',
    component: 'Input',
   },
  {
    label: "上课日",
    field: "attendDate",
    component: 'RangePicker',
    componentProps: {
        valueType: 'Date',
    },
    //colProps: {span: 6},
},
{
    label: "状态",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"subject_status"
    },
    defaultValue: Number(2),
    show:false
    //colProps: {span: 6},
 },
];



/**线下科目缴费统计 列表*/
export const payPersonColumns: BasicColumn[]=[
  {
    title: '部门',
    align:"center",
    dataIndex: 'deptName'
   },
   {
    title: '学期',
    align:"center",
    dataIndex: 'semesterName'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '学号',
    align:"center",
    dataIndex: 'code'
   },
    {
     title: '总金额',
     align:"center",
     dataIndex: 'cost'
    },
    {
     title: '待缴金额',
     align:"center",
     dataIndex: 'payMoney'
    },
    {
     title: '已缴金额',
     align:"center",
     dataIndex: 'payment'
    },
    {
     title: '已退金额',
     align:"center",
     dataIndex: 'refund'
    },
    {
    title: '总节数',
    align:"center",
    dataIndex: 'cnt'
   },
   {
    title: '已完成数',
    align:"center",
    dataIndex: 'normal'
   },
   {
    title: '已退课数',
    align:"center",
    dataIndex: 'unsub'
   },
]
/**线下科目缴费统计 搜索*/
export const searchPayPersonSchema:FormSchema[]=[
  {
    label: '部门',
    field: 'departmentId',
    component: 'JSelectDept',
    componentProps:{
      // checkStrictly:true,
      field:'deptId',
      multiple:false,
      params:{
        businessCode:1002
      }
    }
  },
 {
  label: "学期",
  field: 'semesterId',
  component: 'JDictSelectTag',
  componentProps:{
    dictCode:"cs_semester where del_flag=0 and status=1 order by id desc,name,id"
  },
  //colProps: {span: 6},
},
 {
  label: "姓名",
  field: 'name',
  component: 'Input',
 },
 {
  label: "学号",
  field: 'code',
  component: 'Input',
 },
 {
  label: "排除已退款",
  field: 'ignoreFlag',
  defaultValue:'1',
  component: 'Switch',
      componentProps: {
        //开关大小，可选值：default small
        size:'default',
        //非选中时的内容
        unCheckedChildren:'是',
        //非选中时的值
        unCheckedValue:'0',
        //选中时的内容
        checkedChildren:'否',
        //选中时的值
        checkedValue:'1',
        //是否禁用
        disabled: false
      },
  },
]


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}